<!doctype html>



  


<html class="theme-next mist use-motion" lang="en">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Hexo | Blog," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="今天真高兴，涨了不少姿势。1.学会了使用Hexo搭建一个静态博客2.学会了使用MarkDown这种简单的标记语言编写文章    前几天看到学长在用MarkDown写博客，感觉逼格很高，程序员风格十足。今天终于入门了，现把一些主要步骤记录一下    1.首先要有一个github账号，然后建立一个repository(仓库)，关键点在于 仓库名称要与你的账号名称相同，并在后面加上github.io例如">
<meta name="keywords" content="Hexo | Blog">
<meta property="og:type" content="article">
<meta property="og:title" content="How to build your owner blog with HEXO">
<meta property="og:url" content="http://yoursite.com/2015/04/18/How-to-build-your-owner-blog-with-HEXO/index.html">
<meta property="og:site_name" content="Ji Xiang&#39;s blog">
<meta property="og:description" content="今天真高兴，涨了不少姿势。1.学会了使用Hexo搭建一个静态博客2.学会了使用MarkDown这种简单的标记语言编写文章    前几天看到学长在用MarkDown写博客，感觉逼格很高，程序员风格十足。今天终于入门了，现把一些主要步骤记录一下    1.首先要有一个github账号，然后建立一个repository(仓库)，关键点在于 仓库名称要与你的账号名称相同，并在后面加上github.io例如">
<meta property="og:locale" content="en">
<meta property="og:updated_time" content="2018-11-18T02:59:33.027Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="How to build your owner blog with HEXO">
<meta name="twitter:description" content="今天真高兴，涨了不少姿势。1.学会了使用Hexo搭建一个静态博客2.学会了使用MarkDown这种简单的标记语言编写文章    前几天看到学长在用MarkDown写博客，感觉逼格很高，程序员风格十足。今天终于入门了，现把一些主要步骤记录一下    1.首先要有一个github账号，然后建立一个repository(仓库)，关键点在于 仓库名称要与你的账号名称相同，并在后面加上github.io例如">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    sidebar: {"position":"left","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: 'Author'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2015/04/18/How-to-build-your-owner-blog-with-HEXO/"/>





  <title> How to build your owner blog with HEXO | Ji Xiang's blog </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="en">

  










  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">Ji Xiang's blog</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
    
      <p class="site-subtitle">Walk step by step and learn everyday</p>
    
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            Archives
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            Tags
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="http://yoursite.com/2015/04/18/How-to-build-your-owner-blog-with-HEXO/">

  <span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="Ji Xiang">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="http://o7bp9e1ec.bkt.clouddn.com/1485173143816">
  </span>

  <span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="Ji Xiang's blog">
    <span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="Ji Xiang's blog" src="">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                How to build your owner blog with HEXO
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2015-04-18T18:25:01+08:00">
                2015-04-18
              </time>
            

            

            
          </span>

          

          
            
          

          

          
          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h3 id="今天真高兴，涨了不少姿势。"><a href="#今天真高兴，涨了不少姿势。" class="headerlink" title="今天真高兴，涨了不少姿势。"></a>今天真高兴，涨了不少姿势。</h3><p>1.学会了使用Hexo搭建一个静态博客<br>2.学会了使用MarkDown这种简单的标记语言编写文章   </p>
<p>前几天看到学长在用MarkDown写博客，感觉逼格很高，程序员风格十足。今天终于入门了，现把一些主要步骤记录一下   </p>
<p>1.首先要有一个<a href="https://github.com" target="_blank" rel="noopener">github</a>账号，然后建立一个repository(仓库)，关键点在于 <strong>仓库名称要与你的账号名称相同，并在后面加上github.io</strong><br>例如: 我的github叫做 <strong>jimxiang</strong>,那么就建一个名为 <strong>jimxiang.github.io</strong>的仓库。接下来要配置SSH,网上教程很多，这里不再赘述。**   </p>
<p>2.使用node.js里的npm在命令行里进行接下来的操作   </p>
<h3 id="安装Hexo"><a href="#安装Hexo" class="headerlink" title="安装Hexo"></a>安装Hexo</h3><pre><code> $ npm install -g hexo // -g  表示把hexo安装到全局，不限于当前文件夹，以后重建项目时不必再次安装</code></pre>

<h3 id="部署Hexo"><a href="#部署Hexo" class="headerlink" title="部署Hexo"></a>部署Hexo</h3><pre><code> $ hexo init </code></pre>   
现在已经搭建好本地的hexo博客了，执行以下命令   
<pre><code> $ hexo g   // 生成静态页面至public目录</code></pre>
<pre><code> $ hexo s   // 开启预览访问端口（默认端口4000，'ctrl + c'关闭server）</code></pre>

<h3 id="到浏览器输入-localhost-4000-看看"><a href="#到浏览器输入-localhost-4000-看看" class="headerlink" title="到浏览器输入 localhost:4000 看看"></a>到浏览器输入 <strong>localhost:4000</strong> 看看</h3><h3 id="更换博客主题"><a href="#更换博客主题" class="headerlink" title="更换博客主题"></a>更换博客主题</h3><p>github上有许多<a href="https://github.com/hexojs/hexo/wiki/Themes" target="_blank" rel="noopener">博客主题</a>。现在clone一个你最喜欢的主题   </p>
<pre><code> $ git clone https://github.com/...(主题地址)</code></pre>

<h3 id="例如"><a href="#例如" class="headerlink" title="例如"></a>例如</h3><pre><code> $ git clone https://github.com/wuchong/jacman.git themes/jacman</code></pre>

<h3 id="启用主题"><a href="#启用主题" class="headerlink" title="启用主题"></a>启用主题</h3><p>修改Hexo目录下的config.yml配置文件中的theme属性，将其设置为jacman。   </p>
<pre><code> theme: jacman</code></pre>

<p><strong>注意：Hexo有两个config.yml文件，一个在根目录，一个在theme下，此时修改的是在根目录下的。</strong></p>
<h3 id="更新主题"><a href="#更新主题" class="headerlink" title="更新主题"></a>更新主题</h3><pre><code> $ cd themes/jacman</code></pre>   
<pre><code> $ git pull</code></pre>

<h3 id="使用与调试"><a href="#使用与调试" class="headerlink" title="使用与调试"></a>使用与调试</h3><p>启动本地服务，实时查看你的blog   </p>
<pre><code> $ hexo serve</code></pre>

<h3 id="到了重要的一步：把本地的博客部署到github上（有木有很激动）"><a href="#到了重要的一步：把本地的博客部署到github上（有木有很激动）" class="headerlink" title="到了重要的一步：把本地的博客部署到github上（有木有很激动）"></a>到了重要的一步：把本地的博客部署到github上（有木有很激动）</h3><p>配置 <strong>根目录下的config.yml</strong> 文件   </p>
<pre><code> deploy:</code></pre>   
<pre><code> type: git</code></pre>   
<pre><code> repository: git@github.com/...(你自己的github地址)</code></pre>
<pre><code> branch: master</code></pre>

<h3 id="npm命令"><a href="#npm命令" class="headerlink" title="npm命令"></a>npm命令</h3><pre><code> $ hexo clean</code></pre>   
<pre><code> $ hexo generate</code></pre>   
<pre><code> $ hexo deploy  //这一步会让你输入你的github用户名和密码</code></pre>

<h3 id="到此为止，你可以登陆-xxx-github-io-查看你的博客啦"><a href="#到此为止，你可以登陆-xxx-github-io-查看你的博客啦" class="headerlink" title="到此为止，你可以登陆 xxx.github.io 查看你的博客啦!"></a>到此为止，你可以登陆 <strong>xxx.github.io</strong> 查看你的博客啦!</h3><h3 id="Hexo修改blog主页内容："><a href="#Hexo修改blog主页内容：" class="headerlink" title="Hexo修改blog主页内容："></a>Hexo修改blog主页内容：</h3><p>修改根目录下的 <strong>config.yml</strong> 文件</p>
<h3 id="新建文章"><a href="#新建文章" class="headerlink" title="新建文章"></a>新建文章</h3><pre><code>$ hexo new "（文章名）" //新建一个xxx.md的文件</code></pre>   
使用 **记事本、sublime text、chrome插件** 等编辑 *source/_posts文件下的.md* 文件，借助[MakeDown](http://www.markdown.cn/)语言写入你的文章

### 写完后，推送到服务器上
<pre><code> $ hexo g</code></pre>   
<pre><code> $ hexo d</code></pre>

<p>现在我们完成了用Hexo和github建立静态博客，是不是很有趣呢？赶紧动手吧！</p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>


    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Hexo-Blog/" rel="tag"># Hexo | Blog</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2015/04/18/Quick-Start/" rel="next" title="Quick Strat">
                <i class="fa fa-chevron-left"></i> Quick Strat
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2015/04/25/Design-Patterns/" rel="prev" title="Design Patterns">
                Design Patterns <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>

          
          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            Table of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            Overview
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="http://o7bp9e1ec.bkt.clouddn.com/1485173143816"
               alt="Ji Xiang" />
          <p class="site-author-name" itemprop="name">Ji Xiang</p>
          <p class="site-description motion-element" itemprop="description"></p>
        </div>
        <nav class="site-state motion-element">
        
          
            <div class="site-state-item site-state-posts">
              <a href="/archives">
                <span class="site-state-item-count">20</span>
                <span class="site-state-item-name">posts</span>
              </a>
            </div>
          

          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">14</span>
                <span class="site-state-item-name">tags</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#今天真高兴，涨了不少姿势。"><span class="nav-number">1.</span> <span class="nav-text">今天真高兴，涨了不少姿势。</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安装Hexo"><span class="nav-number">2.</span> <span class="nav-text">安装Hexo</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#部署Hexo"><span class="nav-number">3.</span> <span class="nav-text">部署Hexo</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#到浏览器输入-localhost-4000-看看"><span class="nav-number">4.</span> <span class="nav-text">到浏览器输入 localhost:4000 看看</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#更换博客主题"><span class="nav-number">5.</span> <span class="nav-text">更换博客主题</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#例如"><span class="nav-number">6.</span> <span class="nav-text">例如</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#启用主题"><span class="nav-number">7.</span> <span class="nav-text">启用主题</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#更新主题"><span class="nav-number">8.</span> <span class="nav-text">更新主题</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#使用与调试"><span class="nav-number">9.</span> <span class="nav-text">使用与调试</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#到了重要的一步：把本地的博客部署到github上（有木有很激动）"><span class="nav-number">10.</span> <span class="nav-text">到了重要的一步：把本地的博客部署到github上（有木有很激动）</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#npm命令"><span class="nav-number">11.</span> <span class="nav-text">npm命令</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#到此为止，你可以登陆-xxx-github-io-查看你的博客啦"><span class="nav-number">12.</span> <span class="nav-text">到此为止，你可以登陆 xxx.github.io 查看你的博客啦!</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Hexo修改blog主页内容："><span class="nav-number">13.</span> <span class="nav-text">Hexo修改blog主页内容：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#新建文章"><span class="nav-number">14.</span> <span class="nav-text">新建文章</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Ji Xiang</span>
</div>


<div class="powered-by">
  Powered by <a class="theme-link" href="https://hexo.io">Hexo</a>
</div>

<div class="theme-info">
  Theme -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>


        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  




  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  



  




	





  





  

  
      <!-- UY BEGIN -->
      <script type="text/javascript" src="http://v2.uyan.cc/code/uyan.js?uid="></script>
      <!-- UY END -->
  




  
  

  

  

  

  


</body>
</html>
